package com.fpost.hibernate.util;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateSessionFactory {

	private static HibernateSessionFactory instance;
	private SessionFactory sessionFactory;
		
	private HibernateSessionFactory(){
		sessionFactory = new Configuration().configure().buildSessionFactory();
	}
	
	public static synchronized HibernateSessionFactory getInstance() {
		if (instance == null) {
			 instance = new HibernateSessionFactory();
		}
		return instance;
	}	

	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}
}
